/*
 * Jiri Cigler
 * ciglej1@fel.cvut.cz 
 *
 * Copyright (C) 2007 Jirka Cigler <ciglej1@fel.cvut.cz>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 */ 
#ifndef __TIMER_HH__
#define __TIMER_HH__

#include <ctime>
#include <cmath>

#include "gecode/config.icc"

/*
 * Support for measuring time
 *
 */

/// Timer interface used for examples
class Timer {
	private:
		clock_t t0;
	public:
		void start(void);
		double stop(void);
};

forceinline void
Timer::start(void) {
	t0 = clock();
}
forceinline double
Timer::stop(void) {
	return (static_cast<double>(clock()-t0) / CLOCKS_PER_SEC) * 1000.0;
}


/**
 * \brief Compute arithmetic mean of \a n elements in \a t
 * \relates Timer
 */
double am(double t[], int n);
/**
 * \brief Compute deviation of \a n elements in \a t
 * \relates Timer
 */
double dev(double t[], int n);

#endif//__TIMER_HH__

// STATISTICS: example-any
